Chi-Squared or Crosstabs
POLS 3316: Statistics for Political Scientists

Tom Hanna

2023-11-06

Hypothesis Testing: Chi-square \(X^2\)

  • Background
  • Examples
  • Practice

What is \(X^2\)

  • Frequency distribution

  • Used in hypothesis testing

  • Categorical variables

  • Ideal sample size 50- 1000

              + Less than 10 very unreliable
  • Two hypothesis tests

              - Test of goodness of fit (1 variable)
              - **Test of independence (2 variables)*

\(X^2\) Test of independence

  • Categorical variables

      + Testing if categories are related
      + Men/women, Republicans/Democracts, Northerners/Southerners, Black/White
  • 2nd variable is the thing we look for a difference in

      + Pay, attitudes toward taxes, attitudes toward military service, victimization by police

\(X^2\) Test

  • \(X^2\) tests the P(\(\frac{(Observed - Expected)^2}{Expected}\))
  • The score is \(\frac{(Observed - Expected)^2}{Expected}\))
  • Expected = \(\frac{row total x column total}{sample size}\)
  • H0 (null hypothesis): in the population, the two categorical variables are independent not related
  • H1 (alternative/research hypothesis): in the population, the two categorical variables are dependent related
  • p-value is P(random effect > computed effect) so smaller is better

Chi Square Visualization

Visualization of Chi-Square

Not a normal distribution

Chi Square Distribution

  • the sum of the squares of k independent, zero-mean, unit-variance Gaussian random variables

Example